package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootYys;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Getter
@Setter
public class FootYysSearchForm extends SearchForm implements Serializable {
	private static final long serialVersionUID = 8090668615941861551L;
	protected String userName;
	protected Long userId;
	protected Integer jf;

	public Example buildSearchCommond() {
		Example example = new Example(FootYys.class);
		Example.Criteria criteria = example.createCriteria();
		if (!StringUtils.isEmpty(userName)) {
			criteria.andLike("userName", "%" + userName + "%");
		}
		if (jf != null) {
			criteria.andEqualTo("jf", jf);
		}
        if (userId != null) {
            criteria.andEqualTo("userId", userId);
        }
        criteria.andEqualTo("delFlag", 0);
		example.orderBy("jf desc, sl desc, bscc desc, iss desc, isp desc, isf desc");
		return example;
	}

}
